package ar.edu.unq.wannaplay.roles;

import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.panel.Panel;

import ar.edu.unq.wannaplay.dtos.ClientDTO;
import ar.edu.unq.wannaplay.dtos.EmployeeDTO;
import ar.edu.unq.wannaplay.dtos.ProjectDTO;
import ar.edu.unq.wannaplay.pages.Home;
import ar.edu.unq.wannaplay.pages.client.SingleClientViewPage;
import ar.edu.unq.wannaplay.pages.employee.SingleEmployeeViewPage;
import ar.edu.unq.wannaplay.pages.project.SingleProjectViewPage;
import ar.edu.unq.wannaplay.panels.client.ClientViewPanel;
import ar.edu.unq.wannaplay.panels.employee.EmployeesViewPanel;
import ar.edu.unq.wannaplay.panels.project.ProjectsViewPanel;
import ar.edu.unq.wannaplay.utils.ClientListView;
import ar.edu.unq.wannaplay.utils.EmployeeListView;
import ar.edu.unq.wannaplay.utils.ProjectsListView;
import ar.edu.unq.wannaplay.utils.WPLinkCreatedPage;

public class RegularUserLinkAdderStrategy extends AbstractLinkAdderStrategy {

    private static final long serialVersionUID = 1L;

    @Override
    public void addClientCreateLinks(final ClientViewPanel aPanel) {
        aPanel.add(this.hidingPanel("createClientLink"));
    }

    @Override
    public void addEmployeesViewLinks(final ListItem<EmployeeDTO> item, final EmployeeListView view, final Panel aPanel) {
        item.add(this.createLinkPanel(LINK,
                new WPLinkCreatedPage(LINK, new SingleEmployeeViewPage(item.getModelObject())), "link.panel.view",
                aPanel));
        item.add(this.hidingPanel("delete"));
        item.add(this.hidingPanel("modify"));
    }

    @Override
    public void addEmployeeCreateLink(final EmployeesViewPanel aPanel) {
        aPanel.add(this.hidingPanel("createEmployeeLink"));
    }

    @Override
    public void addProjectsViewLinks(final ListItem<ProjectDTO> item, final ProjectsListView view, final Panel aPanel) {
        item.add(this.createLinkPanel(LINK, new WPLinkCreatedPage(LINK,
                new SingleProjectViewPage(item.getModelObject())), "link.panel.view", aPanel));
        item.add(this.hidingPanel("delete"));
        item.add(this.hidingPanel("modify"));
    }

    @Override
    public void addProjectsCreateLink(final ProjectsViewPanel aPanel) {
        aPanel.add(this.hidingPanel("createProjectLink"));
    }

    @Override
    public void addHomeContent(final Home home) {
        home.add(this.hidingPanel("mainContent"));
    }

    @Override
    public void addClientViewLinks(final ListItem<ClientDTO> item, final ClientListView view, final Panel panel) {
        item.add(this.createLinkPanel(LINK,
                new WPLinkCreatedPage(LINK, new SingleClientViewPage(item.getModelObject())), "link.panel.view", panel));
        item.add(this.hidingPanel("modify"));
    }

}
